/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package convert;

import bean.ShipBean;
import ejb.Ship;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

/**
 *
 * @author owner
 */
public class shipConverter implements Converter {

    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        //throw new UnsupportedOperationException("Not supported yet.");
        ShipBean sb = new ShipBean();
        sb.setShipId(Integer.parseInt(value));
        return sb.getShipById();
    }

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        //throw new UnsupportedOperationException("Not supported yet.");
        return ((Ship)value).getShipId().toString();
    }

}
